<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        Welcome #{accountController.username} modifica il tuo account
        <h:form>
            <table>
                <td><h:commandButton value="Elimina account" action="#{accountController.deleteAccount()}"/></td>
                <td><h:commandButton value="Logout" action="#{accountController.logout()}"/></td>
                <td><h:commandButton value="Cambia password" action="#{accountController.changePassword()}"/></td>
                <tr>
                    <td><h:outputText value="password"/></td>
                    <td><h:inputSecret id="password-input" label="password" binding="#{passwordComponent}" value="#{accountController.password}"/></td>    
                    <td><h:message for="password-input"/></td>
                </tr>
                <tr>
                    <td><h:outputText value="repeat password"/></td>
                    <td><h:inputSecret id="rpassword-input" label="repeat password" value="#{accountController.rpassword}">
                            <f:validator validatorId="confirmPasswordValidator" />
                            <f:attribute name="passwordComponent" value="#{passwordComponent}" />
                        </h:inputSecret>
                    </td>    
                    <td><h:message for="rpassword-input"/></td>
                </tr>
                <td><h:commandButton value="Cambia email" action="#{accountController.changePassword()}"/></td>
                <tr>
                    <td><h:outputText value="email"/></td>
                    <td><h:inputText id="email-input" label="email" value="#{accountController.email}" /></td>    
                    <td><h:message for="email-input"/></td>
                </tr>
            </table>
            <td><h:outputText value="#{accountController.message}"/></td>
        </h:form>
    </h:body>
</html>



